Edit value of n number of <td> using jquery or javascript [on hold]

Posted by Yousaf on Programmers See other posts from Programmers or by Yousaf
Published on 2013-11-09T12:54:29Z Indexed on 2013/11/09 16:12 UTC
Read the original article Hit count: 121

Filed under:
|

Hello Guys I am trying to edit the value of n number of td but i am onlt able to edit 1 value how can edit n number of tds i dont know how many rows could be in table here is my current code i want to do it dynamically

HTML

<input type="text" name="editValue" id="editValue" value="" />
<br>
<table id="testing">
   <tr>
       <td id="tdid">Value1</td>
       <td><a href="#" id="button" >Edit</a></td>
   </tr>
   <tr>
       <td >Value2</td>
       <td><a href="#">Edit</a></td>
   </tr>
</table>

Jquery

$("#button").on('click', function(){
var r = $("#tdid").text();
$("#editValue").val(r);
});

Here is working example

http://jsfiddle.net/M5Gkb/6/

© Programmers or respective owner

Related posts about JavaScript

Related posts about jQuery